<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 模板字符串 ES6提供的一种新的字符串的声明方式
        let str = "hello";
        let str1 = 'hello';

        let str2 = `hello world`
        console.log(str2);

        // 模板字符串，支持内部换行
        let str3 = `
            hello
            world
        `;

        console.log(str3);

        var a = 100;
        var name = "jack";

        var str4 = "姓名：" + name + ",年龄：" + a + "。";
        let str5 = `姓名：${name},年龄：${a}。`


        // 任意的表达式，都可以作为模板字符串的赋值表达式

        let str6 = `hello ${a*100}`;

        let isMale = false;
        let str7 = `hello ${isMale? "先生":"女士"}`
        console.log(str7);


        let fn = () => Date.now();
        let str8 = `现在时间是:${fn()}`
        console.log(str8);


        let arr = ["hello","world"];
        let str9 = `${arr.join("|")}`;
        console.log(str9);


    </script>
</body>
</html>